#!/bin/sh
#set -x
cd ../
ULTRA_PACK_HOME=`pwd`
VISIFIERHOME=$ULTRA_PACK_HOME/visifier
LD_LIBRARY_PATH=$XGLHOME/lib:$XILHOME/lib:/usr/openwin/lib:/usr/lib:$LD_LIBRARY_PATH:$ULTRA_PACK_HOME/lib
PATH=$VISIFIERHOME/bin:$PATH
export ULTRA_PACK_HOME VISIIFIERHOME PATH LD_LIBRARY_PATH 
cd $VISIFIERHOME/bin

./audiocontrol -Wp 500 0 &
./mpeg2_audiodec $VISIFIERHOME/movies/vis_video.abs &
#./mpeg2 $VISIFIERHOME/movies/vis_video.vbs  5 &
./mpeg2 $VISIFIERHOME/movies/vis_video.vbs  5 2>&1 > /dev/null &

echo "To exit the Visifier now, press 'q' <RETURN>"

read reply
until [ "$reply" = "q" ]
do
     echo $reply "is invalid"
     read reply
done

#echo "Kill Processes Here!"

pidproc() {
	pid=`/usr/bin/ps -ef |
		/usr/bin/grep $1 |
		/usr/bin/grep -v grep |
		/usr/bin/awk '{print $2}'`
}

pidproc './mpeg2_audiodec '
[ "$pid" != "" ] && kill $pid

pidproc './mpeg2 '
[ "$pid" != "" ] && kill $pid

pidproc './audiocontrol '
[ "$pid" != "" ] && kill $pid
